const http = require("../../models/https")
const app = getApp()
Page({
  data: {
    value:""
  },
  onLoad: function () {
  },
  onSubmit(event){
    console.log(event.detail.value.content);
    var id = event.detail.value.content;
    http({
      url:`http://47.113.104.50:3000/search?keywords=${id}&type=10`,
      success: (res) => {
        this.setData({
          value:res.data.result.albums
        })
        console.log(this.data.value);
      }
    })
  },
  onChange(event){
    var value = this.data.value;
    value.forEach(res=>{
      if(res.id==event.currentTarget.dataset.id){
        res.state = !res.state;
      }else{
        res.state =false
      }
    })
    this.setData({
      value
    })
  }
})
